<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            border: 3px solid red;
            margin: 100px auto;
            font-size: 72px;
            text-align: center;
            line-height: 100px;
            border-radius: 50%;
        }
    </style>
</head>

<body>
    <div id="box">5</div>
    <script>
        var div = document.getElementById("box");
        var num = 5;

        var timer = window.setInterval(function() {
            num--;
            div.innerHTML = num;
            if (num == 0) {
                window.clearInterval(timer)
            }
        }, 1000)
    </script>
</body>

</html>